﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BuildPlannerLib.Enums;
using BuildPlannerLib.SimEvents;

namespace BuildPlannerLib.Terran.SimEvents
{
    // Derived class of Event for a MULE despawning
    public class MULEDespawn : SimEvent
    {
        // Fields for mineral type and base
        MineralFlags MineralFlags;
        Base Base;

        // Constructor with parameters for parent build, base, mineralflags, and time
        public MULEDespawn(Build build, Base b, MineralFlags mineralFlags, int time)
        {
            Build = build;
            Base = b;
            MineralFlags = mineralFlags;
            Time = time;
        }

        // Sets the mineral patch used to idle for MULEs
        public override void Execute()
        {
            if (MineralFlags == MineralFlags.FarPatch)
            {
                Base.MULEIdleMineralPatches[0]++;
            }
            else if (MineralFlags == MineralFlags.GoldPatch)
            {
                Base.MULEIdleMineralPatches[1]++;
            }
            else if (MineralFlags == MineralFlags.ClosePatch)
            {
                Base.MULEIdleMineralPatches[2]++;
            }
            else if (MineralFlags == (MineralFlags.ClosePatch | MineralFlags.GoldPatch))
            {
                Base.MULEIdleMineralPatches[3]++;
            }
        }
    }
}
